<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<head>
<meta charset="UTF-8" />
<title>Panorama scripting in a nutshell - PanoTools.org Wiki</title>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<meta name="generator" content="MediaWiki 1.23.6" />






<style media="screen" type="text/css" title="Screen style sheet"> @import url(manual.css); </style>

<style>a:lang(ar),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}
/* cache key: panotools_wiki:resourceloader:filter:minify-css:7:90730a7865ba4b50e0b837e1821ff0a3 */</style>



<!--[if lt IE 7]><style type="text/css">body{behavior:url("/skins/vector/csshover.min.htc")}</style><![endif]--></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-Panorama_scripting_in_a_nutshell skin-vector action-view vector-animateLayout">
		
		
		<div id="content" class="mw-body" role="main">
			<a id="top"></a>
			
						<h1 id="firstHeading" class="firstHeading" lang="en"><span dir="auto">Panorama scripting in a nutshell</span></h1>
						<div id="bodyContent">
								<div id="siteSub">From PanoTools.org Wiki</div>
								
												
				<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><p>This is a short document describing the various Open Source tools and techniques available for working with panoramas in a non-GUI environment. The examples are based on Linux experience, but most of them should work on OS X or Windows with minor modifications at most.
</p><p>This document is also useful for understanding what happens 'under the hood' in <a href="Hugin.html" title="Hugin">hugin</a> itself and recommended reading for anyone looking to work with the hugin sourcecode.
</p>
<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="Panorama_scripting_in_a_nutshell.html#Why_would_you_do_that.3F"><span class="tocnumber">1</span> <span class="toctext">Why would you do that?</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="Panorama_scripting_in_a_nutshell.html#PanoTools_.27Scripting.27"><span class="tocnumber">2</span> <span class="toctext">PanoTools 'Scripting'</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="Panorama_scripting_in_a_nutshell.html#Simple_command-line_stitching"><span class="tocnumber">3</span> <span class="toctext">Simple command-line stitching</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="Panorama_scripting_in_a_nutshell.html#Creating_hugin_projects_on_the_command-line"><span class="tocnumber">4</span> <span class="toctext">Creating hugin projects on the command-line</span></a>
<ul>
<li class="toclevel-2 tocsection-5"><a href="Panorama_scripting_in_a_nutshell.html#Generating_the_project_file"><span class="tocnumber">4.1</span> <span class="toctext">Generating the project file</span></a></li>
<li class="toclevel-2 tocsection-6"><a href="Panorama_scripting_in_a_nutshell.html#Generating_control_points"><span class="tocnumber">4.2</span> <span class="toctext">Generating control points</span></a></li>
<li class="toclevel-2 tocsection-7"><a href="Panorama_scripting_in_a_nutshell.html#Pruning_control_points"><span class="tocnumber">4.3</span> <span class="toctext">Pruning control points</span></a></li>
<li class="toclevel-2 tocsection-8"><a href="Panorama_scripting_in_a_nutshell.html#Optimising_positions_and_geometry"><span class="tocnumber">4.4</span> <span class="toctext">Optimising positions and geometry</span></a></li>
<li class="toclevel-2 tocsection-9"><a href="Panorama_scripting_in_a_nutshell.html#Optimising_photometric_parameters"><span class="tocnumber">4.5</span> <span class="toctext">Optimising photometric parameters</span></a></li>
<li class="toclevel-2 tocsection-10"><a href="Panorama_scripting_in_a_nutshell.html#Setting_output_options"><span class="tocnumber">4.6</span> <span class="toctext">Setting output options</span></a></li>
<li class="toclevel-2 tocsection-11"><a href="Panorama_scripting_in_a_nutshell.html#Example_work_flow_similar_to_assistant_in_Hugin_GUI"><span class="tocnumber">4.7</span> <span class="toctext">Example work flow similar to assistant in Hugin GUI</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-12"><a href="Panorama_scripting_in_a_nutshell.html#Stitching_hugin_projects_on_the_command-line"><span class="tocnumber">5</span> <span class="toctext">Stitching hugin projects on the command-line</span></a>
<ul>
<li class="toclevel-2 tocsection-13"><a href="Panorama_scripting_in_a_nutshell.html#Rendering_images"><span class="tocnumber">5.1</span> <span class="toctext">Rendering images</span></a></li>
<li class="toclevel-2 tocsection-14"><a href="Panorama_scripting_in_a_nutshell.html#Blending"><span class="tocnumber">5.2</span> <span class="toctext">Blending</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-15"><a href="Panorama_scripting_in_a_nutshell.html#Holding_it_all_together_with_panostart"><span class="tocnumber">6</span> <span class="toctext">Holding it all together with panostart</span></a></li>
<li class="toclevel-1 tocsection-16"><a href="Panorama_scripting_in_a_nutshell.html#Panotools::Script_for_manipulating_project_files"><span class="tocnumber">7</span> <span class="toctext">Panotools::Script for manipulating project files</span></a></li>
<li class="toclevel-1 tocsection-17"><a href="Panorama_scripting_in_a_nutshell.html#Full_list_of_command-line_tools"><span class="tocnumber">8</span> <span class="toctext">Full list of command-line tools</span></a>
<ul>
<li class="toclevel-2 tocsection-18"><a href="Panorama_scripting_in_a_nutshell.html#Control_point_generation"><span class="tocnumber">8.1</span> <span class="toctext">Control point generation</span></a></li>
<li class="toclevel-2 tocsection-19"><a href="Panorama_scripting_in_a_nutshell.html#Project_file_modification"><span class="tocnumber">8.2</span> <span class="toctext">Project file modification</span></a></li>
<li class="toclevel-2 tocsection-20"><a href="Panorama_scripting_in_a_nutshell.html#Control_point_pruning"><span class="tocnumber">8.3</span> <span class="toctext">Control point pruning</span></a></li>
<li class="toclevel-2 tocsection-21"><a href="Panorama_scripting_in_a_nutshell.html#Optimisation"><span class="tocnumber">8.4</span> <span class="toctext">Optimisation</span></a></li>
<li class="toclevel-2 tocsection-22"><a href="Panorama_scripting_in_a_nutshell.html#Rendering"><span class="tocnumber">8.5</span> <span class="toctext">Rendering</span></a></li>
<li class="toclevel-2 tocsection-23"><a href="Panorama_scripting_in_a_nutshell.html#Blending_2"><span class="tocnumber">8.6</span> <span class="toctext">Blending</span></a></li>
<li class="toclevel-2 tocsection-24"><a href="Panorama_scripting_in_a_nutshell.html#Misc"><span class="tocnumber">8.7</span> <span class="toctext">Misc</span></a></li>
<li class="toclevel-2 tocsection-25"><a href="Panorama_scripting_in_a_nutshell.html#Chromatic_aberration"><span class="tocnumber">8.8</span> <span class="toctext">Chromatic aberration</span></a></li>
<li class="toclevel-2 tocsection-26"><a href="Panorama_scripting_in_a_nutshell.html#Querying"><span class="tocnumber">8.9</span> <span class="toctext">Querying</span></a></li>
<li class="toclevel-2 tocsection-27"><a href="Panorama_scripting_in_a_nutshell.html#TIFF_files"><span class="tocnumber">8.10</span> <span class="toctext">TIFF files</span></a></li>
<li class="toclevel-2 tocsection-28"><a href="Panorama_scripting_in_a_nutshell.html#Output_formats"><span class="tocnumber">8.11</span> <span class="toctext">Output formats</span></a></li>
<li class="toclevel-2 tocsection-29"><a href="Panorama_scripting_in_a_nutshell.html#Older_tools"><span class="tocnumber">8.12</span> <span class="toctext">Older tools</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-30"><a href="Panorama_scripting_in_a_nutshell.html#Useful_Image_processing_tools"><span class="tocnumber">9</span> <span class="toctext">Useful Image processing tools</span></a></li>
</ul>
</div>

<h1><span class="mw-headline" id="Why_would_you_do_that.3F">Why would you do that?</span></h1>
<p>Creating and manipulating panoramas is something that should obviously be done in a graphical tool<a class="external" href="http://wiki.panotools.org/GUI_front-ends">[*]</a>. This is true, but perhaps you find that you are spending more time operating a computer than being a photographer. This is an indication that something is wrong - The computer exists to do the boring work and scripting is one way to make this happen.
</p>
<h1><span class="mw-headline" id="PanoTools_.27Scripting.27">PanoTools 'Scripting'</span></h1>
<p>The file format first used in Helmut Dersch's <a href="Panorama_tools.html" title="Panorama tools">Panorama tools</a> is often referred to as a 'script', but a 'PanoTools' script is really a data file describing a 'panorama stitching project'.
</p><p>Although these original PanoTools are less used today, the file format is alive and well with several variations used as project files by PTGui<a class="external" href="http://wiki.panotools.org/PTGui">[*]</a>, PTAssembler<a class="external" href="http://wiki.panotools.org/PTAssembler">[*]</a>, <a href="Hugin.html" title="Hugin">hugin</a> and related tools. These files are simple plain-text, sometimes it is useful to modify them directly with a text editor - Further on we will introduce various methods for manipulating them via the 'programming' kind of scripts.
</p>
<h1><span class="mw-headline" id="Simple_command-line_stitching">Simple command-line stitching</span></h1>
<p>Lets start with a basic but common use case: Photographers with quality panoramic tripod heads<a class="external" href="http://wiki.panotools.org/Heads">[*]</a> can reproduce identical sets of photos every time, in this situation there is no need to create a new stitching project for every panorama, it is enough to use a single project as a template.
</p><p>This example takes a pre-existing project called template.pto, created with three photos. It uses <a href="Nona.html" title="Nona">nona</a> for remapping, and <a href="Enblend.html" title="Enblend">enblend</a> for blending the remapped photos into a finished <a href="TIFF.html" title="TIFF">TIFF</a> image:
</p>
<pre> nona -o out -m TIFF_m template.pto DSC_1234.JPG DSC_1235.JPG DSC_1236.JPG
 enblend -o finished.tif out0000.tif out0001.tif out0002.tif
</pre>
<p>The first <a href="Nona.html" title="Nona">nona</a> command creates three remapped <a href="TIFF.html" title="TIFF">TIFF</a> images called out0000.tif, out0001.tif etc... the list of input images can be substituted with any set of identically sized photos. The second <a href="Enblend.html" title="Enblend">enblend</a> command uses these TIFF files as input and merges them to a file called finished.tif. template.pto
</p><p>If the internal blender is used, the commands simplify to
</p>
<pre> nona -o out -m TIFF template.pto DSC_1234.JPG DSC_1235.JPG DSC_1236.JPG
</pre>
<h1><span class="mw-headline" id="Creating_hugin_projects_on_the_command-line">Creating hugin projects on the command-line</span></h1>
<p>The entire panorama creation process can be performed on the command-line, and therefore scripted, doing this involves a series of steps similar to the workflow in a GUI tool.
</p>
<h2><span class="mw-headline" id="Generating_the_project_file">Generating the project file</span></h2>
<p>Most of <a href="Hugin.html" title="Hugin">hugin</a> tools take a pto file as input and output. So the first step is to create this pto file. For this purpose use <a href="Pto_gen.html" title="Pto gen">pto_gen</a>.
</p>
<pre>  pto_gen *.jpg
</pre>
<p>will put all jpg files in the current directory into one project file with a default name. You can also specify single images and your own project name
</p>
<pre>  pto_gen -o project.pto image1.jpg image2.jpg image3.jpg
</pre>
<p>You can specify more options to the project (see <a href="Pto_gen.html" title="Pto gen">pto_gen</a> for details).
</p>
<h2><span class="mw-headline" id="Generating_control_points">Generating control points</span></h2>
<p>There are a number of tools available for generating <a href="Control_points.html" title="Control points">control points</a> from groups of photos, like <a href="Cpfind.html" title="Cpfind">cpfind</a>. Here is an example using cpfind
</p>
<pre>  cpfind --multirow -o project.pto project.pto
</pre>
<p>Hint: Other control points generator, such as <a href="Autopano-sift.html" title="Autopano-sift">autopano-sift</a>, autopano-sift-c<a class="external" href="http://wiki.panotools.org/index.php?title=Autopano-sift-c&amp;action=edit&amp;redlink=1">[*]</a>, <a href="Panomatic.html" title="Panomatic">panomatic</a> and match-n-shift<a class="external" href="http://wiki.panotools.org/index.php?title=Match-n-shift&amp;action=edit&amp;redlink=1">[*]</a> take a list of images instead of a project. In this case the pto generation and control point generation are one step. Here is an example for autopano-sift-c:
</p>
<pre> autopano-sift-c --projection 0,50 project.pto DSC_1234.JPG DSC_1235.JPG DSC_1236.JPG
</pre>
<p>This will create a .pto project with <a href="Control_points.html" title="Control points">control points</a> (if any) linking the three photos, note that the <a href="Projections.html" title="Projections">projection</a> format (f0, <a href="Rectilinear_Projection.html" title="Rectilinear Projection">rectilinear</a>) of the input photos and approximate horizontal <a href="Field_of_View.html" title="Field of View">angle of view</a> (v50, 50 degrees) have to be specified.
</p>
<h2><span class="mw-headline" id="Pruning_control_points">Pruning control points</span></h2>
<p>This still isn't a finished panorama, at the very least this involves <a href="Optimization.html" title="Optimization">optimising</a> the camera positions and then rendering the output.
</p><p>You could go ahead and <a href="Optimization.html" title="Optimization">optimise</a> this project file straight away, but this can be a bit hit and miss. First it is a good idea to clean up the <a href="Control_points.html" title="Control points">control points</a>. There are currently two useful tools for cleaning control points: <a href="Using_Celeste_with_hugin.html" title="Using Celeste with hugin">celeste</a> removes points from areas of sky and ptoclean<a class="external" href="http://wiki.panotools.org/index.php?title=Ptoclean&amp;action=edit&amp;redlink=1">[*]</a> removes points with large error distances, first <a href="Celeste_standalone.html" title="Celeste standalone">celeste_standalone</a>:
</p>
<pre> celeste_standalone -i project.pto -o project.pto
</pre>
<p>Then ptoclean<a class="external" href="http://wiki.panotools.org/index.php?title=Ptoclean&amp;action=edit&amp;redlink=1">[*]</a>:
</p>
<pre> ptoclean -v --output project.pto project.pto
</pre>
<p>Note that in both cases we are overwriting the input project.pto file with the cleaned output. If you want you can create intermediate temporary files and keep each step in case you need to backtrack.
</p><p>(Other control point cleaners are ptscluster<a class="external" href="http://wiki.panotools.org/index.php?title=Ptscluster&amp;action=edit&amp;redlink=1">[*]</a> and the new <a href="Cpclean.html" title="Cpclean">cpclean</a>)
</p>
<h2><span class="mw-headline" id="Optimising_positions_and_geometry">Optimising positions and geometry</span></h2>
<p>Up to now, the project file simply contains an image list and <a href="Control_points.html" title="Control points">control points</a>, the images are not yet aligned, you can do this by <a href="Optimization.html" title="Optimization">optimising</a> geometric parameters with the <a href="Autooptimiser.html" title="Autooptimiser">autooptimiser</a> tool:
</p>
<pre> autooptimiser -a -l -s -o project.pto project.pto
</pre>
<p>Now you could just skip ahead and render the output if photometric <a href="Optimization.html" title="Optimization">optimisation</a> isn't required.
</p><p>By adding the -m switch also photometric optimisation is done. So the output project is optimised for positions, geometry and photometric parameters in one run:
</p>
<pre> autooptimiser -a -l -s -m -o project.pto project.pto
</pre>
<p>If you need finer control above the optimisation, set the parameter which should be optimized with <a href="Pto_var.html" title="Pto var">pto_var</a> and then run <a href="Autooptimiser.html" title="Autooptimiser">autooptimiser</a> with switch -n:
</p>
<pre> pto_var --opt y,p,r -o project.pto project.pto
 autooptimiser -n -o project.pto project.pto
</pre>
<p>(PToptimizer<a class="external" href="http://wiki.panotools.org/index.php?title=PToptimizer&amp;action=edit&amp;redlink=1">[*]</a> is an alternative geometrical optimiser)
</p>
<h2><span class="mw-headline" id="Optimising_photometric_parameters">Optimising photometric parameters</span></h2>
<p>Photos have photometric exposure variables which can be <a href="Optimization.html" title="Optimization">optimised</a> in much the same way as aligning positions. Doing this can remove brightness, white balance<a class="external" href="http://wiki.panotools.org/White_balance">[*]</a> and <a href="Vignetting.html" title="Vignetting">vignetting</a> differences between photos, giving better blending or allowing creation of <a href="HDR.html" title="HDR">HDR</a> images.
</p><p>For doing an automatic photometric optimisation like Hugin's assistant, run <a href="Autooptimiser.html" title="Autooptimiser">autooptimiser</a> with -m switch:
</p>
<pre> autooptimiser -m -o project.pto project.pto
</pre>
<p>For full manual control for photometric parameters use <a href="Vig_optimize.html" title="Vig optimize">vig_optimize</a>. This program does the equivalent job for photometric parameters as <a href="Autooptimiser.html" title="Autooptimiser">autooptimiser</a> does for geometric parameters. You need to indicate in the .pto project which parameters are 'variables'. For this task you can edit the .pto file or use a tool such as <a href="Pto_var.html" title="Pto var">pto_var</a> or ptovariable<a class="external" href="http://wiki.panotools.org/index.php?title=Ptovariable&amp;action=edit&amp;redlink=1">[*]</a>:
</p>
<pre> ptovariable --vignetting --response --exposure project.pto
 vig_optimize -o project.pto project.pto
</pre>
<pre> pto_var --opt Vb,Vx,Ra,EeV -o project.pto project.pto
 vig_optimize -o project.pto project.pto
</pre>
<h2><span class="mw-headline" id="Setting_output_options">Setting output options</span></h2>
<p>For setting the output option (like on the <a href="Hugin_Stitcher_tab.html" title="Hugin Stitcher tab">stitcher tab</a>) use <a href="Pano_modify.html" title="Pano modify">pano_modify</a>:
</p>
<pre>   pano_modify -o project.pto --center --straighten --canvas=AUTO --crop=AUTO project.pto
</pre>
<p>This command will straighten the pano, center it on the canvas, calculates the optimal size and calculates the optimal output region.
</p>
<h2><span class="mw-headline" id="Example_work_flow_similar_to_assistant_in_Hugin_GUI">Example work flow similar to assistant in Hugin GUI</span></h2>
<p>We will use the same project file for all single steps. We always overwrite the same project file. You can also use another filename for every step.
</p><p>1) Generate pto file
</p>
<pre>    pto_gen -o project.pto *.jpg
</pre>
<p>2) Find control points with cpfind, with celeste to ignore clouds
</p>
<pre>    cpfind -o project.pto --multirow --celeste project.pto
</pre>
<p>3) Control point cleaning
</p>
<pre>    cpclean -o project.pto project.pto
</pre>
<p>4) Find vertical lines
</p>
<pre>    linefind -o project.pto project.pto
</pre>
<p>5) Optimize position, do photometric optimization, straighten panorama and select suitable output projection
</p>
<pre>    autooptimiser -a -m -l -s -o project.pto project.pto
</pre>
<p>6) Calculate optimal crop and optimal size
</p>
<pre>    pano_modify --canvas=AUTO --crop=AUTO -o project.pto project.pto
</pre>
<p>7) Now create output
</p>
<pre>    hugin_executor --prefix=prefix project.pto
</pre>
<h1><span class="mw-headline" id="Stitching_hugin_projects_on_the_command-line">Stitching hugin projects on the command-line</span></h1>
<h2><span class="mw-headline" id="Rendering_images">Rendering images</span></h2>
<p>The <a href="Hugin.html" title="Hugin">hugin</a> tool for remapping and distorting the photos into the final panorama frame is <a href="Nona.html" title="Nona">nona</a>, it uses the .pto project file as a set of instructions:
</p>
<pre> nona -m TIFF_m -o project project.pto
</pre>
<p>This <a href="Nona.html" title="Nona">nona</a> command creates one remapped <a href="TIFF.html" title="TIFF">TIFF</a> image for each of the input photos, these will be named project0000.tif, project0001.tif, project0002.tif etc...
</p><p>(<a href="PTblender.html" title="PTblender">PTblender</a> is an alternative renderer to <a href="Nona.html" title="Nona">nona</a>)
</p>
<h2><span class="mw-headline" id="Blending">Blending</span></h2>
<p><a href="Nona.html" title="Nona">nona</a> can do rudimentary assembly of the remapped images, but a much better tool for this is <a href="Enblend.html" title="Enblend">enblend</a>, feed it the images, it will pick seam lines and blend the overlapping areas:
</p>
<pre> enblend -o project.tif project0000.tif project0001.tif project0002.tif ...
</pre>
<p>Finally this produces the stitched panorama: project.tif
</p>
<h1><span class="mw-headline" id="Holding_it_all_together_with_panostart">Holding it all together with panostart</span></h1>
<p>The .pto.mk <i>Makefile</i> helps with the stitching at the end of the process, but doesn't help with the bits at the beginning such as: identifying which photos go in which panorama, generating <a href="Control_points.html" title="Control points">control points</a>, pruning and <a href="Optimization.html" title="Optimization">optimising</a>.
</p><p>panostart<a class="external" href="http://wiki.panotools.org/index.php?title=Panostart&amp;action=edit&amp;redlink=1">[*]</a> is a prototype tool that does it all. Given a list of photos in a folder, it identifies likely panoramas by comparing <a href="EXIF.html" title="EXIF">EXIF</a> timestamps and writes a meta-<i>Makefile</i> containing: rules for generating .pto projects with match-n-shift<a class="external" href="http://wiki.panotools.org/index.php?title=Match-n-shift&amp;action=edit&amp;redlink=1">[*]</a>, rules for generating corresponding .pto.mk <i>Makefile</i>s with pto2mk<a class="external" href="http://wiki.panotools.org/Pto2mk">[*]</a>, rules for stitching the projects with <i>make</i>, plus some other rules for creating useful distributable output.
</p><p>A typical panostart<a class="external" href="http://wiki.panotools.org/index.php?title=Panostart&amp;action=edit&amp;redlink=1">[*]</a> command for dealing with a folder full of photos taken with a pocket point-and-shoot camera on auto-exposure might look like this:
</p>
<pre> panostart --output Makefile --projection 0 --fov 50 --nostacks --loquacious *.JPG
</pre>
<p>Processing this <i>Makefile</i> is simple:
</p>
<pre> make
</pre>
<p>Some of the resulting panoramas will have position, cropping and stitching errors. Fix these by editing the relevant .pto projects in <a href="Hugin.html" title="Hugin">hugin</a> or another tool, when you type <i>make</i> again on the command-line, only those projects that have changed will be restitched.
</p><p>Another advantage of doing things this way is reproducibility: delete all the (enormous) <a href="TIFF.html" title="TIFF">TIFF</a> output panoramas and all you need to keep permanently are the photos, the meta-<i>Makefile</i> and the associated .pto projects. If you ever need to recreate the TIFF panoramas in the future, just type <i>make</i>. If you know the name of the TIFF file you want, just type 'make project.tif' and only a single panorama will be processed.
</p>
<h1><span class="mw-headline" id="Panotools::Script_for_manipulating_project_files">Panotools::Script for manipulating project files</span></h1>
<p>The name is a historical mistake, Panotools::Script<a class="external" href="http://wiki.panotools.org/index.php?title=Panotools_Script&amp;action=edit&amp;redlink=1">[*]</a> is a perl library for working with <a href="Hugin.html" title="Hugin">hugin</a> .pto projects, though it could be extended in the future to cover any of the related file formats. Many of the command-line tools described in this document are written with this library.
</p><p>Here is a trivial script, all it does is open and save a .pto project, it also resets the output ('p' Panorama line) <a href="Field_of_View.html" title="Field of View">angle of view</a> to 360 degrees (v360), the <a href="Projections.html" title="Projections">projection</a> format to <a href="Equirectangular_Projection.html" title="Equirectangular Projection">equirectangular</a> (f2) and the output pixel size to 4096x2048 pixels (w4096 h2048):
</p>
<pre> #!/usr/bin/perl
 use Panotools::Script;
 my $pto = new Panotools::Script;
 $pto-&gt;Read ($ARGV[0]);
 $pto-&gt;Panorama-&gt;Set (v =&gt; 360, f =&gt; 2, w =&gt; 4096, h = 2048);
 $pto-&gt;Write ($ARGV[0]);
</pre>
<p>Here's slightly more complex script, this iterates over the input images and increments the white balance<a class="external" href="http://wiki.panotools.org/White_balance">[*]</a> making the panorama slightly 'warmer':
</p>
<pre> #!/usr/bin/perl
 use Panotools::Script;
 my $pto = new Panotools::Script;
 $pto-&gt;Read ($ARGV[0]);
 for my $image (@{$pto-&gt;Image})
 {
     my $Er_new = $image-&gt;{Er} * 100 / 95; # red value
     my $Eb_new = $image-&gt;{Eb} * 95 / 100; # blue value
     $image-&gt;Set (Er =&gt; $Er_new, Eb =&gt; $Eb_new);
 }
 $pto-&gt;Write ($ARGV[0]);
</pre>
<h1><span class="mw-headline" id="Full_list_of_command-line_tools">Full list of command-line tools</span></h1>
<h2><span class="mw-headline" id="Control_point_generation">Control point generation</span></h2>
<ul>
<li> <a href="Cpfind.html" title="Cpfind">cpfind</a> - Hugins own control point detector
</li>
<li> autopano-sift-c<a class="external" href="http://wiki.panotools.org/index.php?title=Autopano-sift-c&amp;action=edit&amp;redlink=1">[*]</a> - All in one keypoint generator and matcher
</li>
<li> match-n-shift<a class="external" href="http://wiki.panotools.org/index.php?title=Match-n-shift&amp;action=edit&amp;redlink=1">[*]</a> - All in one wrapper around <a href="Align_image_stack.html" title="Align image stack">align_image_stack</a> and autopano-sift-c<a class="external" href="http://wiki.panotools.org/index.php?title=Autopano-sift-c&amp;action=edit&amp;redlink=1">[*]</a>
</li>
<li> <a href="Panomatic.html" title="Panomatic">panomatic</a> - All in one alternative to autopano-sift-c<a class="external" href="http://wiki.panotools.org/index.php?title=Autopano-sift-c&amp;action=edit&amp;redlink=1">[*]</a>
</li>
<li> <a href="Align_image_stack.html" title="Align image stack">align_image_stack</a> - Generates <a href="Control_points.html" title="Control points">control points</a> for stacked photos
</li>
<li> ptoanchor - add control points to a Hugin project
</li>
<li> ptochain - add control points to a Hugin project between consecutive photos
</li>
<li> ptobind - Join the ends of linked photos in a Hugin project
</li>
<li> ptofill - add control points to a Hugin project between likely overlapping photos
</li>
<li> generatekeys - Keypoint generator
</li>
<li> autopano - Keypoint matcher, part of autopano-sift-c<a class="external" href="http://wiki.panotools.org/index.php?title=Autopano-sift-c&amp;action=edit&amp;redlink=1">[*]</a> and not to be confused with autopano
</li>
</ul>
<h2><span class="mw-headline" id="Project_file_modification">Project file modification</span></h2>
<ul>
<li> <a href="Pto_gen.html" title="Pto gen">pto_gen</a> - Generates a new pto project from image files
</li>
<li> match-n-shift<a class="external" href="http://wiki.panotools.org/index.php?title=Match-n-shift&amp;action=edit&amp;redlink=1">[*]</a> - (see above) Default usage is to initialise a new .pto project from EXIF data
</li>
<li> ptoset - Change global parameters and project options
</li>
<li> ptovariable<a class="external" href="http://wiki.panotools.org/index.php?title=Ptovariable&amp;action=edit&amp;redlink=1">[*]</a> - Set typical <a href="Optimization.html" title="Optimization">optimisation</a> variables
</li>
<li> <a href="Pto_var.html" title="Pto var">pto_var</a> - Manipulate image variable, can also set <a href="Optimization.html" title="Optimization">optimisation</a> variables
</li>
<li> <a href="Pto_lensstack.html" title="Pto lensstack">pto_lensstack</a> - Manipulate lenses and stacks
</li>
<li> <a href="Pto_mask.html" title="Pto mask">pto_mask</a> - Add mask to project file
</li>
<li> <a href="Pto_template.html" title="Pto template">pto_template</a> - Apply template to project file
</li>
<li> ptsed - Set any project parameter, convert .pto into PanoTools format
</li>
<li> ptosort<a class="external" href="http://wiki.panotools.org/index.php?title=Ptosort&amp;action=edit&amp;redlink=1">[*]</a> - Sort <a href="Control_points.html" title="Control points">control points</a> or images, remove duplicate control points
</li>
<li> ptopath - Remove file paths in project files
</li>
<li> transform-pano<a class="external" href="http://wiki.panotools.org/index.php?title=Transform-pano&amp;action=edit&amp;redlink=1">[*]</a> - <a href="Roll.html" title="Roll">Roll</a>, <a href="Pitch.html" title="Pitch">pitch</a> and <a href="Yaw.html" title="Yaw">yaw</a> rotation of .pto projects
</li>
<li> ptocentre - Rotate projects to put images in panorama centre
</li>
<li> <a href="Pano_modify.html" title="Pano modify">pano_modify</a> Change output parameters of project file
</li>
</ul>
<ul>
<li> ptomerge<a class="external" href="http://wiki.panotools.org/index.php?title=Ptomerge&amp;action=edit&amp;redlink=1">[*]</a> - Join two or more projects
</li>
<li> <a href="Pto_merge.html" title="Pto merge">pto_merge</a> Merges two or more Hugin project files (this is a different tool to ptomerge above)
</li>
<li> ptosplit<a class="external" href="http://wiki.panotools.org/index.php?title=Ptosplit&amp;action=edit&amp;redlink=1">[*]</a> - Extract subsets of images from a project into a new project
</li>
</ul>
<h2><span class="mw-headline" id="Control_point_pruning">Control point pruning</span></h2>
<ul>
<li> ptscluster - Clean 'bad' <a href="Control_points.html" title="Control points">control points</a> based on distances and position
</li>
<li> <a href="Celeste_standalone.html" title="Celeste standalone">celeste_standalone</a> - Clean sky <a href="Control_points.html" title="Control points">control points</a>
</li>
<li> ptoclean<a class="external" href="http://wiki.panotools.org/index.php?title=Ptoclean&amp;action=edit&amp;redlink=1">[*]</a> - Clean 'bad' <a href="Control_points.html" title="Control points">control points</a> based on standard deviation error
</li>
<li> <a href="Cpclean.html" title="Cpclean">cpclean</a> - An improved version of ptoclean<a class="external" href="http://wiki.panotools.org/index.php?title=Ptoclean&amp;action=edit&amp;redlink=1">[*]</a>, part of the <a href="Hugin.html" title="Hugin">hugin</a> project
</li>
</ul>
<h2><span class="mw-headline" id="Optimisation">Optimisation</span></h2>
<ul>
<li> <a href="Autooptimiser.html" title="Autooptimiser">autooptimiser</a> - <a href="Optimization.html" title="Optimization">Optimise</a> geometry of .pto projects
</li>
<li> PToptimizer<a class="external" href="http://wiki.panotools.org/index.php?title=PToptimizer&amp;action=edit&amp;redlink=1">[*]</a> - <a href="Optimization.html" title="Optimization">Optimize</a> geometry of PanoTools format projects
</li>
<li> <a href="Vig_optimize.html" title="Vig optimize">vig_optimize</a> - <a href="Optimization.html" title="Optimization">Optimise</a> photometric parameters of .pto projects
</li>
</ul>
<h2><span class="mw-headline" id="Rendering">Rendering</span></h2>
<ul>
<li> <a href="Nona.html" title="Nona">nona</a> - Default <a href="Hugin.html" title="Hugin">hugin</a> rendering engine
</li>
<li> nona-mask<a class="external" href="http://wiki.panotools.org/index.php?title=Nona-mask&amp;action=edit&amp;redlink=1">[*]</a> - Wrapper around <a href="Nona.html" title="Nona">nona</a> for using external bitmap masks
</li>
<li> <a href="PTmender.html" title="PTmender">PTmender</a> - Render PanoTools format projects
</li>
</ul>
<ul>
<li> PTAInterpolate<a class="external" href="http://wiki.panotools.org/index.php?title=PTAInterpolate&amp;action=edit&amp;redlink=1">[*]</a> - Create intermediate images from PanoTools projects
</li>
</ul>
<h2><span class="mw-headline" id="Blending_2">Blending</span></h2>
<ul>
<li> <a href="Enblend.html" title="Enblend">enblend</a> - Merge partially overlapping images with multiresolution splines
</li>
<li> <a href="Verdandi.html" title="Verdandi">verdandi</a> - Merge partially overlapping images with watershed algorithm
</li>
<li> <a href="Enfuse.html" title="Enfuse">enfuse</a> - Merge overlapping images with exposure fusion
</li>
<li> PTroller - Merge partially overlapping images with no seaming
</li>
<li> PTmasker - Compute stitching masks for input by PTroller
</li>
<li> enblend-mask - Wrapper around <a href="Enblend.html" title="Enblend">enblend</a> for using external bitmap masks
</li>
<li> enfuse-mask - Wrapper around <a href="Enfuse.html" title="Enfuse">enfuse</a> for using external bitmap masks
</li>
<li> deghosting_mask - Creates mask for removing ghosting in images
</li>
<li> hugin_hdrmerge<a class="external" href="http://wiki.panotools.org/index.php?title=Hugin_hdrmerge&amp;action=edit&amp;redlink=1">[*]</a> - Merge <a href="Bracketing.html" title="Bracketing">bracketed</a> images for <a href="HDR.html" title="HDR">HDR</a> generation
</li>
<li> enblend-svg - Wrapper around <a href="Enblend.html" title="Enblend">enblend</a> for specifying input images via SVG files
</li>
</ul>
<ul>
<li> process-masks - Allow 'positive' masking in external masks for <a href="Enblend.html" title="Enblend">enblend</a>
</li>
<li> tif2svg - Assemble multiple <a href="TIFF.html" title="TIFF">TIFF</a> images into SVG files for enblend-svg
</li>
<li> <a href="PTblender.html" title="PTblender">PTblender</a> - Correct colour and brightness of overlapping images
</li>
</ul>
<h2><span class="mw-headline" id="Misc">Misc</span></h2>
<ul>
<li> panostart<a class="external" href="http://wiki.panotools.org/index.php?title=Panostart&amp;action=edit&amp;redlink=1">[*]</a> - All-in-one panorama workflow via <i>Makefile</i>s
</li>
<li> gigastart - All-in-one assembly of multi-row panoramas
</li>
<li> <a href="Hugin_executor.html" title="Hugin executor">hugin_executor</a> - Stitch project or run assistant from command line
</li>
<li> gigatile<a class="external" href="http://wiki.panotools.org/index.php?title=Gigatile&amp;action=edit&amp;redlink=1">[*]</a> - Create a Makefile for stitching a project as multi-resolution tiles
</li>
<li> ptodummy<a class="external" href="http://wiki.panotools.org/index.php?title=Ptodummy&amp;action=edit&amp;redlink=1">[*]</a> - Generate missing input photos to debug .pto projects
</li>
<li> calibrate_lens<a class="external" href="http://wiki.panotools.org/index.php?title=Calibrate_lens&amp;action=edit&amp;redlink=1">[*]</a> - Automatic lens calibration using straight-line detection
</li>
<li> pafextract<a class="external" href="http://wiki.panotools.org/index.php?title=Pafextract&amp;action=edit&amp;redlink=1">[*]</a> - Tool to use <a href="Panoglview.html" title="Panoglview">panoglview</a> as a zenith and nadir editor<a class="external" href="http://wiki.panotools.org/Zenith_and_Nadir_editing_overview">[*]</a>
</li>
</ul>
<h2><span class="mw-headline" id="Chromatic_aberration">Chromatic aberration</span></h2>
<ul>
<li> <a href="Fulla.html" title="Fulla">fulla</a> - Correct lens distortion and <a href="Chromatic_aberration.html" title="Chromatic aberration">chromatic aberration</a>
</li>
<li> <a href="Tca_correct.html" title="Tca correct">tca_correct</a> - Calculate <a href="Chromatic_aberration.html" title="Chromatic aberration">chromatic aberration</a> in a photo
</li>
</ul>
<h2><span class="mw-headline" id="Querying">Querying</span></h2>
<ul>
<li> ptograph - Draw undirected graphs of projects
</li>
<li> ptoget - Query any project parameter
</li>
<li> ptoinfo - Generate a report on a project file
</li>
<li> PTinfo - Display info about a panotools generated <a href="TIFF.html" title="TIFF">TIFF</a> file
</li>
<li> <a href="Panoinfo.html" title="Panoinfo">panoinfo</a> - Display information about installed libpano13<a class="external" href="http://wiki.panotools.org/index.php?title=Libpano13&amp;action=edit&amp;redlink=1">[*]</a> library
</li>
<li> pano_trafo - transform between image and panorama coordinates (and vice versa)
</li>
</ul>
<h2><span class="mw-headline" id="TIFF_files">TIFF files</span></h2>
<ul>
<li> PTtiff2psd - Join multiple <a href="TIFF.html" title="TIFF">TIFF</a> images into a multilayer <a href="PSD.html" title="PSD">PSD</a> file
</li>
<li> PTtiffdump - Compare two TIFF files
</li>
<li> PTcrop - Remove unwanted empty space in <a href="TIFF.html" title="TIFF">TIFF</a> files and replace with offsets
</li>
<li> PTuncrop - Replace offsets in <a href="TIFF.html" title="TIFF">TIFF</a> files with empty pixels
</li>
</ul>
<h2><span class="mw-headline" id="Output_formats">Output formats</span></h2>
<ul>
<li> <a href="Qtvr2img.html" title="Qtvr2img">qtvr2img</a> - Extract six cubefaces from a cubic <a href="QTVR.html" title="QTVR">QTVR</a>
</li>
<li> cubic2erect - Render six cubefaces into a single <a href="Equirectangular_Projection.html" title="Equirectangular Projection">equirectangular</a> image
</li>
<li> qtvr2erect - Render a cubic <a href="QTVR.html" title="QTVR">QTVR</a> into a single <a href="Equirectangular_Projection.html" title="Equirectangular Projection">equirectangular</a> image
</li>
<li> jpeg2qtvr - Assemble six <a href="JPEG.html" title="JPEG">JPEG</a> cubefaces into a cubic <a href="QTVR.html" title="QTVR">QTVR</a>
</li>
<li> erect2qtvr<a class="external" href="http://wiki.panotools.org/index.php?title=Erect2qtvr&amp;action=edit&amp;redlink=1">[*]</a> - Render a single <a href="Equirectangular_Projection.html" title="Equirectangular Projection">equirectangular</a> image into a cubic <a href="QTVR.html" title="QTVR">QTVR</a>
</li>
</ul>
<ul>
<li> erect2cubic - Create a .pto project for extracting cube faces from an <a href="Equirectangular_Projection.html" title="Equirectangular Projection">equirectangular</a> image
</li>
<li> erect2planet - Create a .pto project for extracting a 'little planet' from an <a href="Equirectangular_Projection.html" title="Equirectangular Projection">equirectangular</a> image
</li>
<li> erect2mercator - Create a .pto project for extracting a mercator view from an <a href="Equirectangular_Projection.html" title="Equirectangular Projection">equirectangular</a> image
</li>
</ul>
<h2><span class="mw-headline" id="Older_tools">Older tools</span></h2>
<p>Helmut Dersch's <a href="PTOptimizer.html" title="PTOptimizer">PTOptimizer</a> and <a href="PTStitcher.html" title="PTStitcher">PTStitcher</a> were the original command-line tools. These are not really recommendable any more as they require an older, buggier version of the libpano12<a class="external" href="http://wiki.panotools.org/index.php?title=Libpano12&amp;action=edit&amp;redlink=1">[*]</a> library, they are closed source so don't work on modern systems such as OS X or 64bit Linux, and are lacking in features compared to modern replacements such as <a href="Autooptimiser.html" title="Autooptimiser">autooptimiser</a> and <a href="Nona.html" title="Nona">nona</a>.
</p>
<h1><span class="mw-headline" id="Useful_Image_processing_tools">Useful Image processing tools</span></h1>
<ul>
<li> ImageMagick<a class="external" href="http://wiki.panotools.org/ImageMagick">[*]</a> - Many utilities for converting, manipulating and resizing images
</li>
<li> GraphicsMagick - A  fork of ImageMagick with many improvements
</li>
<li> libtiff - Supplied with useful tools such as tiffcp for joining and recompression, and tifficc for adding ICC colour profiles
</li>
<li> exiftool<a class="external" href="http://wiki.panotools.org/Exiftool">[*]</a> - All purpose reading, setting and copying of <a href="EXIF.html" title="EXIF">EXIF</a> data
</li>
<li> exiv2 - <a href="EXIF.html" title="EXIF">EXIF</a> manipulation, useful for setting the file modification date from the EXIF date
</li>
<li> jpegtran - Lossless rotation of <a href="JPEG.html" title="JPEG">JPEG</a> images
</li>
<li> ufraw-batch - Command-line <a href="RAW.html" title="RAW">RAW</a> processing
</li>
<li> dcraw<a class="external" href="http://wiki.panotools.org/Dcraw">[*]</a> - Command-line <a href="RAW.html" title="RAW">RAW</a> processing
</li>
</ul>




</div>								<div class="printfooter">
				Retrieved from "http://wiki.panotools.org/index.php?title=Panorama_scripting_in_a_nutshell&amp;oldid=15702<a class="external" href="http://wiki.panotools.org/index.php?title=Panorama_scripting_in_a_nutshell&amp;oldid=15702">[*]</a>"				</div>
												</div></div></body></html>